/*Motor28BYJ-48*/
#include "Motor28BYJ48.h"

void Motor28BYJ48Delay(unsigned int i)
{
	while(i--);
}

//步进电机驱动（方向）
void Motor28BYJ48Drive(char direction)
{
	int time=200;
	if(direction==0)
	{
		MOTOA=1;MOTOB=0;MOTOC=0;MOTOD=1;
		Motor28BYJ48Delay(time);
		MOTOA=0;MOTOB=0;MOTOC=0;MOTOD=1;
		Motor28BYJ48Delay(time);
		MOTOA=0;MOTOB=0;MOTOC=1;MOTOD=1;
		Motor28BYJ48Delay(time);
		MOTOA=0;MOTOB=0;MOTOC=1;MOTOD=0;
		Motor28BYJ48Delay(time);
		MOTOA=0;MOTOB=1;MOTOC=1;MOTOD=0;
		Motor28BYJ48Delay(time);
		MOTOA=0;MOTOB=1;MOTOC=0;MOTOD=0;
		Motor28BYJ48Delay(time);
		MOTOA=1;MOTOB=1;MOTOC=0;MOTOD=0;
		Motor28BYJ48Delay(time);
		MOTOA=1;MOTOB=0;MOTOC=0;MOTOD=0;
	}
	else
	{
		MOTOA=1;MOTOB=0;MOTOC=0;MOTOD=0;
		Motor28BYJ48Delay(time);
		MOTOA=1;MOTOB=1;MOTOC=0;MOTOD=0;
		Motor28BYJ48Delay(time);
		MOTOA=0;MOTOB=1;MOTOC=0;MOTOD=0;
		Motor28BYJ48Delay(time);
		MOTOA=0;MOTOB=1;MOTOC=1;MOTOD=0;
		Motor28BYJ48Delay(time);
		MOTOA=0;MOTOB=0;MOTOC=1;MOTOD=0;
		Motor28BYJ48Delay(time);
		MOTOA=0;MOTOB=0;MOTOC=1;MOTOD=1;
		Motor28BYJ48Delay(time);
		MOTOA=0;MOTOB=0;MOTOC=0;MOTOD=1;
		Motor28BYJ48Delay(time);
		MOTOA=1;MOTOB=0;MOTOC=0;MOTOD=1;
	}
	Motor28BYJ48Delay(time);
}
